import time
import datetime

class Runtime:
    def __init__(self, point=5):
        self.__count = 1
        self.__point = f'.{point}f'

    def __call__(self):
        if self.__count:
            self.__start_time = time.time()
            self.__count -= 1
            return None

        else:
            self.__runtime = time.time() - self.__start_time
            self.__count += 1
            return f'{self.__runtime: {self.__point}}'

    def dec_runtime(self, func):
        def wrapper(*args, **kwargs):
            start_time = time.time()
            res = func(*args, **kwargs)
            runtime = time.time() - start_time
            return (res, f'{runtime: {self.__point}}')
        return wrapper


class Timer:
    def __init__(self, text, seconds):
        self.__text = text
        self.__seconds = seconds

    def sleep(self):
        time.sleep(self.__seconds)


class FmtTime:
    def __init__(self):
        full_time = time.localtime()
        self.second = full_time.tm_sec
        self.month = full_time.tm_mon
        self.month_day = full_time.tm_mday
        self.hour = full_time.tm_hour
        self.minute = full_time.tm_min
        self.week_day = full_time.tm_wday
        self.year_day = full_time.tm_yday
        self.full_time = datetime.now()

    def __str__(self):
        return self.full_time
    __repr__ = __str__


if __name__ == '__main__':
    r = Runtime()
    r()
    print('This is a time')
    print(f'waste {r()} second')

    @r.dec_runtime
    def test():
        time.sleep(1)
        return True
    print(test())

